package com.lineage.data.npc.quest;

import com.lineage.config.ConfigOther;
import com.lineage.data.executor.NpcExecutor;
import com.lineage.server.model.Instance.L1NpcInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.serverpackets.S_NPCTalkReturn;
import com.lineage.server.serverpackets.ServerBasePacket;
import com.lineage.server.timecontroller.event.ranking.RankingHeroTimer;
import com.lineage.server.timecontroller.event.ranking.RankingHeroTimerlv;

public class Npc_HeroRanking extends NpcExecutor {
  public static NpcExecutor get() {
    return new Npc_HeroRanking();
  }
  
  public int type() {
    return 3;
  }
  
  public void talk(L1PcInstance pc, L1NpcInstance npc) {
    pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(npc.getId(), "y_h_1"));
  }
  
  public void action(L1PcInstance pc, L1NpcInstance npc, String cmd, long amount) {
    String[] userName = new String[11];
    if (ConfigOther.RankLevel) {
      if (cmd.equals("c")) {
        String[] names = RankingHeroTimerlv.userNameC();
        int i = 0;
        while (i < names.length) {
          userName[i] = names[i];
          i++;
        } 
        userName[10] = "王族";
      } else if (cmd.equals("k")) {
        String[] names = RankingHeroTimerlv.userNameK();
        int i = 0;
        while (i < names.length) {
          userName[i] = names[i];
          i++;
        } 
        userName[10] = "骑士";
      } else if (cmd.equals("e")) {
        String[] names = RankingHeroTimerlv.userNameE();
        int i = 0;
        while (i < names.length) {
          userName[i] = names[i];
          i++;
        } 
        userName[10] = "精灵";
      } else if (cmd.equals("w")) {
        String[] names = RankingHeroTimerlv.userNameW();
        int i = 0;
        while (i < names.length) {
          userName[i] = names[i];
          i++;
        } 
        userName[10] = "法师";
      } else if (cmd.equals("d")) {
        String[] names = RankingHeroTimerlv.userNameD();
        int i = 0;
        while (i < names.length) {
          userName[i] = names[i];
          i++;
        } 
        userName[10] = "黑暗精灵";
      } else if (cmd.equals("g")) {
        String[] names = RankingHeroTimerlv.userNameG();
        int i = 0;
        while (i < names.length) {
          userName[i] = names[i];
          i++;
        } 
        userName[10] = "龙骑士";
      } else if (cmd.equals("i")) {
        String[] names = RankingHeroTimerlv.userNameI();
        int i = 0;
        while (i < names.length) {
          userName[i] = names[i];
          i++;
        } 
        userName[10] = "幻术师";
      } else if (cmd.equals("a")) {
        String[] names = RankingHeroTimerlv.userNameAll();
        int i = 0;
        while (i < names.length) {
          userName[i] = names[i];
          i++;
        } 
        userName[10] = "全职业";
      } 
    } else if (cmd.equals("c")) {
      String[] names = RankingHeroTimer.userNameC();
      int i = 0;
      while (i < names.length) {
        userName[i] = names[i];
        i++;
      } 
      userName[10] = "王族";
    } else if (cmd.equals("k")) {
      String[] names = RankingHeroTimer.userNameK();
      int i = 0;
      while (i < names.length) {
        userName[i] = names[i];
        i++;
      } 
      userName[10] = "骑士";
    } else if (cmd.equals("e")) {
      String[] names = RankingHeroTimer.userNameE();
      int i = 0;
      while (i < names.length) {
        userName[i] = names[i];
        i++;
      } 
      userName[10] = "精灵";
    } else if (cmd.equals("w")) {
      String[] names = RankingHeroTimer.userNameW();
      int i = 0;
      while (i < names.length) {
        userName[i] = names[i];
        i++;
      } 
      userName[10] = "法师";
    } else if (cmd.equals("d")) {
      String[] names = RankingHeroTimer.userNameD();
      int i = 0;
      while (i < names.length) {
        userName[i] = names[i];
        i++;
      } 
      userName[10] = "黑暗精灵";
    } else if (cmd.equals("g")) {
      String[] names = RankingHeroTimer.userNameG();
      int i = 0;
      while (i < names.length) {
        userName[i] = names[i];
        i++;
      } 
      userName[10] = "龙骑士";
    } else if (cmd.equals("i")) {
      String[] names = RankingHeroTimer.userNameI();
      int i = 0;
      while (i < names.length) {
        userName[i] = names[i];
        i++;
      } 
      userName[10] = "幻术师";
    } else if (cmd.equals("a")) {
      String[] names = RankingHeroTimer.userNameAll();
      int i = 0;
      while (i < names.length) {
        userName[i] = names[i];
        i++;
      } 
      userName[10] = "全职业";
    } 
    if (userName != null) {
      String htmlid = "y_h_2";
      pc.sendPackets((ServerBasePacket)new S_NPCTalkReturn(npc.getId(), "y_h_2", userName));
    } 
  }
}
